package org.eae.eldf.service.sys.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import org.eae.eldf.dao.sys.ISysParameterDao;
import org.eae.eldf.dao.sys.impl.SysParameterDaoImpl;
import org.eae.eldf.dto.sys.SysParameterQueryDto;
import org.eae.eldf.entity.sys.SysParameter;
import org.eae.eldf.framework.pager.Pagination;
import org.eae.eldf.framework.persistence.Criteria;
import org.eae.eldf.framework.service.BaseServiceImpl;
import org.eae.eldf.service.sys.SysParameterService;

@Service
@Transactional
public class SysParameterServiceImpl extends BaseServiceImpl<SysParameter> implements SysParameterService{

	private ISysParameterDao sParameterDao;
    @Autowired
	public void setsParameterDao(SysParameterDaoImpl sParameterDao) {
		this.sParameterDao = sParameterDao;
		this.dao = sParameterDao;
		
	}
	@Override
	public Pagination<SysParameter> getAllParams(
			Pagination<SysParameter> pages,  SysParameterQueryDto sysParameterQueryDto) {
		pages=sParameterDao.pageParamsList(pages, sysParameterQueryDto);
		return pages;
	}
	@Override
	public SysParameter findByParamsId(Long id) {
		return sParameterDao.get(SysParameter.class, id);
	}
	
	
	@Override
	public SysParameter getByParamsName(String parametername) {
		return sParameterDao.findByParamsName(parametername);
	}
	
	@Override
	public void delete(Long id) {
	Criteria criteria=Criteria.create(SysParameter.class).where("sysParameterId",new Object[]{id});
	sParameterDao.delete(criteria);
		
	}
}
